home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C / Games / Xconq 7.1.0 / src / xconq-7.1.0 / kernel / module.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-07  |  5.3 KB  |  136 lines  |  [TEXT/R*ch]

  1. /* Definitions for game modules in Xconq.
  2.    Copyright (C) 1991, 1992, 1993, 1994, 1995 Stanley T. Shebs.
  3.  
  4. Xconq is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2, or (at your option)
  7. any later version.  See the file COPYING.  */
  8.  
  9. /* A variant describes an option that is available to players starting
  10.    up a game, as well as modules including each other. */
  11.  
  12. typedef struct a_variant {
  13.     Obj *id;            /* unique id */
  14.     char *name;            /* displayable name */
  15.     Obj *dflt;            /* default value */
  16.     Obj *range;            /* description of range of values */
  17.     Obj *cases;            /* actions to do on matches */
  18.     int used;            /* true if the variant has been set to a value already */
  19.     int hasintvalue;        /* true if integer value defined */
  20.     int intvalue;        /* integer value of the variant */
  21. } Variant;
  22.  
  23. /* A file module records relevant info about the module, what it included,
  24.    how to write it out, etc. */
  25.  
  26. typedef struct a_module {
  27.     char *name;            /* the actual unique name of the module */
  28.     char *title;        /* a readable display name */
  29.     char *blurb;        /* a descriptive one-liner */
  30.     char *picturename;        /* name of a descriptive image */
  31.     char *basemodulename;    /* name of the module that this one includes */
  32.     char *defaultbasemodulename;  /* what game to load if something missing */
  33.     char *basegame;        /* what general game this is based on */
  34.     Obj *instructions;        /* basic instructions */
  35.     Obj *notes;            /* player notes */
  36.     Obj *designnotes;        /* designer notes */
  37.     char *version;        /* the version of this module */
  38.     char *programversion;    /* compatible program versions */
  39.     Variant *variants;        /* array of player-choosable variants */
  40.     char *origmodulename;    /* module that this was originally (before save) */
  41.     Variant *origvariants;    /* variants chosen for the original module */
  42.     char *origversion;        /* the version of the original module */
  43.     char *contents;        /* a string with the actual contents */
  44.     char *sp;            /* "string pointer" a la file pointer */
  45.     char *filename;        /* the filename */
  46.     FILE *fp;            /* the stdio file buffer */
  47.     char *hook;            /* space for system-specific file info */
  48.     int startlineno;        /* line number being read at start of form */
  49.     int endlineno;        /* line number being read at end of form */
  50.     /* Primarily for designer use, to control writing of a module */
  51.     short def_all;        /* true if all data is to be written out */
  52.     short read_only;        /* true if shouldn't be modified */
  53.     short def_types;        /* flags indicating what to put in a module */
  54.     short def_tables;
  55.     short compress_tables;
  56.     short def_globals;
  57.     short def_scoring;
  58.     short def_world;
  59.     short def_areas;
  60.     short def_area_terrain;
  61.     short def_area_misc;
  62.     short def_area_weather;
  63.     short def_area_material;
  64.     short compress_layers;    /* true if layer data should be compressed when written */
  65.     short def_sides;
  66.     short def_side_views;
  67.     short def_side_doctrines;
  68.     short def_players;
  69.     short def_agreements;
  70.     short def_units;
  71.     short def_unit_ids;
  72.     short def_unit_props;
  73.     short def_unit_acts;
  74.     short def_unit_plans;
  75.     short def_history;
  76.     short maybe_reshape;
  77.     int subarea_width;
  78.     int subarea_height;
  79.     int subarea_x;
  80.     int subarea_y;
  81.     int final_subarea_width;
  82.     int final_subarea_height;
  83.     int final_subarea_x;
  84.     int final_subarea_y;
  85.     int final_width;
  86.     int final_height;
  87.     int final_circumference;
  88.     short fill_type;
  89.     short open;            /* true if currently open */
  90.     short loaded;        /* true if already loaded */
  91.     struct a_module *next;    /* pointer to next module */
  92.     struct a_module *include;    /* pointer to first included module */
  93.     struct a_module *nextinclude;  /* pointer to next included module */
  94.     struct a_module *lastinclude;  /* pointer to last included module */
  95. } Module;
  96.  
  97. /* Iteration over the list of modules. */
  98.  
  99. #define for_all_modules(m)  \
  100.   for (m = modulelist; m != NULL; m = m->next)
  101.  
  102. #define for_all_includes(m,sub)  \
  103.   for (sub = m->include; sub != NULL; sub = sub->nextinclude)
  104.  
  105. extern Module *modulelist;
  106. extern Module *mainmodule;
  107.  
  108. /* Declarations of module functions. */
  109.  
  110. extern void clear_game_modules PARAMS ((void));
  111. extern Module *create_game_module PARAMS ((char *name));
  112. extern Module *find_game_module PARAMS ((char *name));
  113. extern Module *get_game_module PARAMS ((char *name));
  114. extern Module *add_game_module PARAMS ((char *name, Module *includer));
  115. extern void describe_game_modules PARAMS ((int arg, char *key, char *buf));
  116. extern void describe_game_module_aux PARAMS ((char *buf, Module *module, int level));
  117. extern void describe_module_notes PARAMS ((char *buf, Module *module));
  118. extern void load_default_game PARAMS ((void));
  119. extern int load_game_description PARAMS ((Module *module));
  120. extern void load_game_module PARAMS ((Module *module, int dowarn));
  121. extern void load_base_module PARAMS ((Module *module));
  122. extern int open_module PARAMS ((Module *module, int dowarn));
  123. extern void read_forms PARAMS ((Module *module));
  124. extern void init_module_reshape PARAMS ((Module *module));
  125. extern int reshape_the_output PARAMS ((Module *module));
  126. extern int valid_reshape PARAMS ((Module *module));
  127. extern void close_module PARAMS ((Module *module));
  128. extern char *module_desig PARAMS ((Module *module));
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.